# 使用openjdk:8-jdk-alpine作为基础镜像
FROM openjdk:8-jdk-alpine
RUN echo "http://mirrors.aliyun.com/alpine/v3.6/main" > /etc/apk/repositories \
    && echo "http://mirrors.aliyun.com/alpine/v3.6/community" >> /etc/apk/repositories \
    && apk update upgrade \
    && apk add --no-cache procps unzip curl bash tzdata \
    && apk add ttf-dejavu \
    && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && echo "Asia/Shanghai" > /etc/timezone

# 复制jar文件到镜像中
ADD ./target/service-join-1.0-SNAPSHOT.jar /app/service-join-1.0-SNAPSHOT.jar

# 设置工作目录
WORKDIR /app

# 暴露容器的端口
EXPOSE 8002 8724
# 设置时区为东八区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 定义默认命令，启动Java应用程序
CMD ["java", "-jar","-XX:MaxMetaspaceSize=128m", "-Xms64m", "-Xmx64m", "-Xmn16m","-XX:SurvivorRatio=6",  "-Dserver.port=8002", "service-join-1.0-SNAPSHOT.jar"]